package com.deke.home.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * OSS存储配置类
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
@Component
@Configuration
public class OssConstant implements InitializingBean {
    @Value("${aliyun.oss.endPoint}")
    private String oss_endpoint;

    @Value("${aliyun.oss.accessKeyId}")
    private String oss_accessKeyId;

    @Value("${aliyun.oss.accessKeySecret}")
    private String oss_accessKeySecret;

    @Value("${aliyun.oss.bucketName}")
    private String oss_bucketName;



    public static String OSS_END_POINT_IM;
    public static String OSS_BUCKET_IM;
    public static String OSS_ACCESS_KEY_ID_IM;
    public static String OSS_ACCESS_KEY_SECRET_IM;

    @Override
    public void afterPropertiesSet() throws Exception {
        OSS_END_POINT_IM = oss_endpoint;
        OSS_BUCKET_IM = oss_bucketName;
        OSS_ACCESS_KEY_ID_IM = oss_accessKeyId;
        OSS_ACCESS_KEY_SECRET_IM = oss_accessKeySecret;
    }
}

